/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file           : main.h
  * @brief          : Header for main.c file.
  *                   This file contains the common defines of the application.
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; Copyright (c) 2023 STMicroelectronics.
  * All rights reserved.</center></h2>
  *
  * This software component is licensed by ST under Ultimate Liberty license
  * SLA0044, the "License"; You may not use this file except in compliance with
  * the License. You may obtain a copy of the License at:
  *                             www.st.com/SLA0044
  *
  ******************************************************************************
  */
/* USER CODE END Header */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "stm32f1xx_hal.h"
#include "stm32f1xx_ll_dma.h"
#include "stm32f1xx_ll_rcc.h"
#include "stm32f1xx_ll_bus.h"
#include "stm32f1xx_ll_system.h"
#include "stm32f1xx_ll_exti.h"
#include "stm32f1xx_ll_cortex.h"
#include "stm32f1xx_ll_utils.h"
#include "stm32f1xx_ll_pwr.h"
#include "stm32f1xx_ll_tim.h"
#include "stm32f1xx_ll_usart.h"
#include "stm32f1xx.h"
#include "stm32f1xx_ll_gpio.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */

/* USER CODE END ET */

/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */

/* USER CODE END EC */

/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */

/* USER CODE END EM */

/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);

/* USER CODE BEGIN EFP */

/* USER CODE END EFP */

/* Private defines -----------------------------------------------------------*/
#define KEY_A_Pin LL_GPIO_PIN_13
#define KEY_A_GPIO_Port GPIOC
#define KEY_B_Pin LL_GPIO_PIN_14
#define KEY_B_GPIO_Port GPIOC
#define Z_SW_Pin LL_GPIO_PIN_15
#define Z_SW_GPIO_Port GPIOC
#define ADC0_Pin LL_GPIO_PIN_0
#define ADC0_GPIO_Port GPIOA
#define BEEP_Pin LL_GPIO_PIN_1
#define BEEP_GPIO_Port GPIOA
#define HMI_TX_Pin LL_GPIO_PIN_2
#define HMI_TX_GPIO_Port GPIOA
#define HMI_RX_Pin LL_GPIO_PIN_3
#define HMI_RX_GPIO_Port GPIOA
#define ADC1_Pin LL_GPIO_PIN_4
#define ADC1_GPIO_Port GPIOA
#define BM_D_Pin LL_GPIO_PIN_5
#define BM_D_GPIO_Port GPIOA
#define BM_B_Pin LL_GPIO_PIN_6
#define BM_B_GPIO_Port GPIOA
#define BM_A_Pin LL_GPIO_PIN_7
#define BM_A_GPIO_Port GPIOA
#define SW1_Pin LL_GPIO_PIN_0
#define SW1_GPIO_Port GPIOB
#define U_MOSI_Pin LL_GPIO_PIN_1
#define U_MOSI_GPIO_Port GPIOB
#define U_MISO_Pin LL_GPIO_PIN_2
#define U_MISO_GPIO_Port GPIOB
#define U_VD_FZ_Pin LL_GPIO_PIN_10
#define U_VD_FZ_GPIO_Port GPIOB
#define U_CS_Pin LL_GPIO_PIN_11
#define U_CS_GPIO_Port GPIOB
#define U_RSTB_Pin LL_GPIO_PIN_12
#define U_RSTB_GPIO_Port GPIOB
#define AM_A_Pin LL_GPIO_PIN_13
#define AM_A_GPIO_Port GPIOB
#define AM_B_Pin LL_GPIO_PIN_14
#define AM_B_GPIO_Port GPIOB
#define AM_D_Pin LL_GPIO_PIN_15
#define AM_D_GPIO_Port GPIOB
#define MCO_Pin LL_GPIO_PIN_8
#define MCO_GPIO_Port GPIOA
#define SW3_Pin LL_GPIO_PIN_9
#define SW3_GPIO_Port GPIOA
#define SW2_Pin LL_GPIO_PIN_10
#define SW2_GPIO_Port GPIOA
#define SWDIO_Pin LL_GPIO_PIN_13
#define SWDIO_GPIO_Port GPIOA
#define SWCLK_Pin LL_GPIO_PIN_14
#define SWCLK_GPIO_Port GPIOA
#define SW4_Pin LL_GPIO_PIN_15
#define SW4_GPIO_Port GPIOA
#define U_SCK_Pin LL_GPIO_PIN_3
#define U_SCK_GPIO_Port GPIOB
#define PI1_Pin LL_GPIO_PIN_4
#define PI1_GPIO_Port GPIOB
#define PI1_EXTI_IRQn EXTI4_IRQn
#define PI2_Pin LL_GPIO_PIN_5
#define PI2_GPIO_Port GPIOB
#define PI2_EXTI_IRQn EXTI9_5_IRQn
#define PI3_Pin LL_GPIO_PIN_6
#define PI3_GPIO_Port GPIOB
#define PI4_Pin LL_GPIO_PIN_7
#define PI4_GPIO_Port GPIOB
/* USER CODE BEGIN Private defines */

#define L1_DT2x 1
#define MCO_CLK 24000000

#define MOTOR_TEST_MODE 0
#define AP_CALIBRATION_MODE 0

#define SEGGER_DEBUG 1

#if SEGGER_DEBUG
    #include <stdio.h>
    #include "SEGGER_RTT.h"
    #define printf(...) SEGGER_RTT_printf(0,__VA_ARGS__)
#else
     #define printf(...)
#endif

/* USER CODE END Private defines */

#ifdef __cplusplus
}
#endif

#endif /* __MAIN_H */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
